<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<form name="form1">
			<img src="images/10.jpg" alt="">
		</form>
		
		<button onclick="add()">添加用户头像</button>
		
		<script type="text/javascript">
			function add()
			{
                var randomNum = Math.floor(Math.random()*5)+5;
				// 创建一个网页元素对象
				var img = document.createElement("img");
				// 设定属性
                img.src="images/"+randomNum+".jpg";
				
				// 放入到某个元素下面
				document.form1.appendChild(img);
				
			}
		</script>
	</body>
</html>